#ifndef _CSCATTERPLOT_H_
#define _CSCATTERPLOT_H_

#include <buola/chart/plots/cxyplot.h>

#include <buola/image/ccolor.h>
#include <buola/chart/evaluemapper.h>
#include <buola/chart/cseries.h>

namespace buola { namespace chart {

class CScatterPlot : public CXYPlot
{
public:
    CScatterPlot();
    virtual ~CScatterPlot();

public:
/////////////// interface /////////////////
    void SetSeries(PSeries pSeries);

    void SetColor(const img::CColor &pColor);

    void SetPointColor(const img::CColor &pColor);
    void SetPointDiameterSeries(PSeries pSeries);
    void SetPointDiameterMapper(EValueMapper<double,double> *pMapper);
    void SetPointDiameter(double pDiameter);
    void SetPointFillColorSeries(PSeries pSeries);
    void SetPointFillColorMapper(EValueMapper<double,img::CColor> *pMapper);
    void SetPointFillColor(const img::CColor &pColor);
    void SetPointShape(ePointShape pShape);

    double GetMinX()        {   return mSeries->mMin.x; }
    double GetMinPosX()     {   return mSeries->mMinPos.x;  }
    double GetMaxX()        {   return mSeries->mMax.x; }
    double GetMinY()        {   return mSeries->mMin.y; }
    double GetMinPosY()     {   return mSeries->mMinPos.y;  }
    double GetMaxY()        {   return mSeries->mMax.y; }
    CRect_d GetExtraSpace();

    virtual void Draw(CXYChartContext &pC);
    virtual double GetDist(const CPoint_d &pPos,CXAxis *pXAxis,CYAxis *pYAxis);
    virtual CPoint_d GetNearestPoint(const CPoint_d &pPos,CXAxis *pXAxis,CYAxis *pYAxis);

protected:
/////////////////// properties ////////////////////
    PSeries mSeries;

    img::CColor mPointColor;
    img::CColor mPointFillColor;
    double mPointDiameter;
    ePointShape mPointShape;

    PSeries mColorSeries;
    PSeries mDiameterSeries;

    std::unique_ptr<EValueMapper<double,img::CColor>> mColorMapper;
    std::unique_ptr<EValueMapper<double,double>> mDiameterMapper;
};

/*namespace chart*/ } /*namespace buola*/ }

#endif
